﻿@{
    ViewBag.Title = "Change Password - Project Management System";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Change Password</h2>
<form id="form" action="" method="post">
<div class="content-box" id="User">
    <!-- Start Content Box -->
    <div class="content-box-header">
        <h3>
            Change Password </h3>
        <div class="clear">
        </div>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">
        @{ if (TempData["Message"] != null)
           {
            <div class="notification png_bg" id="messageBox">
                <a href="#" class="close">
                    <img src="../../Content/images/icons/cross_grey_small.png" title="Close this notification"
                        alt="close" /></a>
                <div>
                    @TempData["Message"].ToString()
                </div>
            </div>
           }
        }
        <fieldset>
            <p>
                <label class="width12 floatLeft">
                    Old Password:</label>
                <input type="text" id="txtOldPassword" name="OldPassword" class="width20 input-inline text-input" value=""/>
            </p>
             <p>
                <label class="width12 floatLeft">
                    New Password:</label>
                <input type="text" id="txtNewPassword" name="NewPassword" class="width20 input-inline text-input" value=""/>
            </p>
             <p>
                <label class="width12 floatLeft">
                    Confirm Password:</label>
                <input type="text" id="txtConfirmPassword" name="ConfirmPassword" class="width20 input-inline text-input" value=""/>
            </p>
            <p>
                <input class="button" type="button" value="Save" id="btnSubmit" />
            </p>
        </fieldset>
    </div>
</div>
</form>
<script type="text/javascript">
    $("#Setting").addClass("current");
    $("#ChangePassword").addClass("current");

    $(".text-input").keydown(function (event) {
        if (event.keyCode == 13) {
            ChangePassword();
        }
    });

    $("#btnSubmit").click(function () {
        ChangePassword();

    });

    function ChangePassword() {
        if ($("#txtOldPassword").val() == '') {
            jAlert("Please, Enter Old Password!", "Message");
            return;
        }
        if ($("#txtNewPassword").val() == '') {
            jAlert("Please, Enter New Password!", "Message");
            return;
        }
        if ($("#txtConfirmPassword").val() == '') {
            jAlert("Please, Enter Confirm New Password!", "Message");
            return;
        }
        if ($("#txtConfirmPassword").val() != $("#txtNewPassword").val()) {
            jAlert("New Password Does Not Match!", "Message");
            return;
        }
        $('form').submit();
    }

    
</script>
